package com.jbl.te.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jbl.te.entity.Major;
import com.jbl.te.entity.Departmentclass;
import com.jbl.te.entity.Departmentclass;
import com.jbl.te.entity.Major;
import com.jbl.te.entity.vo.DepartmentclassQuery;
import com.jbl.te.mapper.DepartmentclassMapper;
import com.jbl.te.service.MajorService;
import com.jbl.te.service.DepartmentclassService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jbl
 * @since 2020-12-11
 */
@Service
public class DepartmentclassServiceImpl extends ServiceImpl<DepartmentclassMapper, Departmentclass> implements DepartmentclassService {

    @Override
    public void pageQuery(Page<Departmentclass> pageParam, DepartmentclassQuery departmentclassQuery) {
        if (departmentclassQuery == null) {
            this.page(pageParam,null);
            return;
        }
        String name = departmentclassQuery.getName();
        String MajorId = departmentclassQuery.getMajorId();
        QueryWrapper<Departmentclass> wrapper = new QueryWrapper<>();

        if(!StringUtils.isEmpty(name)) {
            wrapper.like("name",name);
        }
        if(!StringUtils.isEmpty(MajorId)) {
            wrapper.eq("Major_id",MajorId);
        }
        this.page(pageParam,wrapper);
    }
}
